package com.baizhi.interceptor;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//这是用来添加自定义拦截器的类
@Component  //此注解用来告诉框架底层 我们的自定义拦截器的拦截配置
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加自定义拦截器类   并指明其拦截配置
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/ok.html")
                .excludePathPatterns("/login.html","/interceptor/login","hero.html","/hero/*","/layui/*");
    }
}
